import {messages} from "share/common";
import React from 'react'
import {connect} from 'react-redux'
import {Tabs} from 'antd'
const TabPane = Tabs.TabPane;
import 'styles/sub-application/sub-application.scss';
import EditSubApplicationInfo from 'containers/setting/sub-application-privatization/sub-application-management/edit-sub-application';
import EditSubApplicationRecord from 'containers/setting/sub-application-privatization/edit-sub-application/edit-sub-application-records';

class EditSubApplicationIndex extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      disabled: true,
      defaultActiveKey: 'basic_info',
      source: '',
      appCode: props.params.code,
      appName: props.location.state.appName,
      params: {
        sectionCode: props.location.state.sectionCode,
        appName: props.location.state.appName,
        appDesc: props.location.state.appDesc,
      },
    }
  }

  componentWillMount() {

  }

  render() {
    const {appCode, defaultActiveKey, params, appName} = this.state;
    return (
      <div>
        <Tabs defaultActiveKey={defaultActiveKey}>
          <TabPane tab={messages('setting.key1240')/*基本信息*/} key={'basic_info'}>
            <EditSubApplicationInfo appCode={appCode} params={params}/>
          </TabPane>
          <TabPane tab={messages('setting.key2057')/*版本记录*/} key={'version_record'} disabled={false}>
            <EditSubApplicationRecord appCode={appCode} appName={appName}/>
          </TabPane>
        </Tabs>
      </div>
    )
  }
}

EditSubApplicationIndex.contextTypes = {
  router: React.PropTypes.object
};

function mapStateToProps(state) {
  return {
    language: state.main.language
  }
}

export default connect(mapStateToProps)(EditSubApplicationIndex)
